//
//  ServerBlue.h
//  blue_classic_plus
//
//  Created by os on 1/19/24.
//

#import <Foundation/Foundation.h>
#import <Flutter/Flutter.h>
#import <CoreBluetooth/CoreBluetooth.h>
#import "BlueClassicPlusPlugin.h"


NS_ASSUME_NONNULL_BEGIN

@interface ServerBlue : NSObject<CBPeripheralManagerDelegate>

@property (nonatomic,assign) BOOL serverListening;

@property (nonatomic,weak) FlutterEventSink sink;

//定义一个CBPeripheralManager属性，用于管理外设
@property (nonatomic, strong) CBPeripheralManager *peripheralManager;

@property (nonatomic,copy) NSString * uuid;
@property (nonatomic,copy) NSString * name;

//定义一个CBMutableService属性，用于添加服务
@property (nonatomic, strong) CBMutableService *service;

//定义一个CBMutableCharacteristic属性，用于添加特征
@property (nonatomic, strong) CBMutableCharacteristic *characteristic;

//定义一个初始化方法，传入一个代理对象和一个队列
- (instancetype)initWithSink:(FlutterEventSink)sink uuid:(NSString *)uuid name:(NSString *)name;

//定义一个开始广播的方法，传入一个广播数据字典
- (void)startAdvertising:(NSDictionary *)advertisementData;

//定义一个关闭服务端的方法
- (void)stopServer;

//定义一个广播方法，传入一个数据对象
- (void)broadcastData:(NSData *)data;


@end

NS_ASSUME_NONNULL_END
